package org.mybatis.generator.my;

import org.mybatis.generator.my.config.IConfig;
import org.mybatis.generator.my.config.PropertiesConfig;
import org.mybatis.generator.my.gen.BaseGenerator;
import org.web3j.tuples.generated.Tuple4;

import java.util.Arrays;

public class Main {

    public static void main(String[] args) throws Exception {
        generateAsahiint();
//        getGenDemoDb();
    }

    public static void generateAsahiint() throws Exception {
        Tuple4<String, String, String, String>[] tuple4s = new Tuple4[]{
                new Tuple4<>("ATTENTION", "CODE", "ASAHIINT", null),
                new Tuple4<>("BASE", "CODE", "ASAHIINT", null),
                new Tuple4<>("SETTING", "CODE", "ASAHIINT", null),
                new Tuple4<>("SETTING_2", "CODE", "ASAHIINT", null),
                new Tuple4<>("NEWMENUFILE", "MENULINE", "ASAHIINT", null)
        };
        IConfig config = new PropertiesConfig("oracle.properties");
        config.init();
        BaseGenerator generator = new BaseGenerator(config);
        Arrays.asList(tuple4s).stream().forEach(t -> {
            generator.genCode(t.component1(), t.component2(), t.component3(), t.component4());
        });
    }

    public static void getGenDemoDb() throws Exception {
        Tuple4<String, String, String, String>[] tuple4s = new Tuple4[]{
                new Tuple4<>("user_info", "id", "demo_db", null)
        };
        IConfig config = new PropertiesConfig("mysql.properties");
        config.init();
        BaseGenerator generator = new BaseGenerator(config);
        Arrays.asList(tuple4s).stream().forEach(t -> {
            generator.genCode(t.component1(), t.component2(), t.component3(), t.component4());
        });
    }

}
